<div class="events index">
    <?php if ($event_time == 'upcoming') { ?>
    <h2><?php __('My Upcoming Events'); ?></h2>
    <?php } else {?>
    <h2><?php __('My Past Events'); ?></h2>
    <?php } ?>
    <table>
        <tr>
            <td class="actions" width="60">
                <?php echo $this->Html->link(__('Add Event', true), array('controller' => 'events', 'action' => 'add')); ?>
            </td>
            <td class="actions">
                <?php echo $this->Html->link(__('Upcoming', true), array('controller' => 'events', 'action' => 'index','upcoming')); ?>
                <?php echo $this->Html->link(__('Past', true), array('controller' => 'events', 'action' => 'index','past')); ?>
            </td>
        </tr>
    </table>

    <?php if ($events) { ?>
    <?php foreach ($events as $event) { ?>
        <h3><?php echo $event['Event']['event_name']; ?></h3>
        <div class="event_listing">
            <div class="event_listing_left">
                <?php
                    if (file_exists('img/event/' . $event['Event']['id'] . '.jpg')) {
                        echo $this->Html->image('event/' . $event['Event']['id'] . '.jpg', array('width' => '90'));
                    } else {
                        echo $this->Html->image('default_event.jpg', array('width' => '90'));
                    }
                ?>
            </div>
            
            <div class="event_listing_right">
                <p><span class="small_title">Location: </span><?php echo $event['Event']['venue_addr1'] . ', ' . $event['Event']['venue_city'] . ', '
                												 . $event['Event']['venue_state'] . ' '  . $event['Event']['venue_postal']; ?>
                </p>
                <p><span class="small_title">Start Time: </span><?php echo $event['Event']['event_start']; ?></p>
                <p><span class="small_title">End Time: </span><?php echo $event['Event']['event_end']; ?></p>
                <p><span class="small_title">Details: </span><?php echo $event['Event']['description']; ?></p>
                <p><span class="small_title">Type: </span><?php echo $event['Event']['event_type']; ?></p>
                <p><span class="small_title">Number of Attendances: </span><?php echo $event['Event']['total_attendance']; ?></p>
         
         <table>
            <td class="actions">
            	<?php echo $this->Html->link(__('Edit Event', true), array('controller' => 'events', 'action' => 'edit', $event['Event']['id']));?>
            </td>
            <td class="actions">
            	<?php echo $this->Html->link(__('Invite Guests', true), array('controller' => 'events', 'action' => 'invite', $event['Event']['id']));?>
            </td>
         </table>
         
            </div>
            
            <div style="clear:both;"></div>
        </div>
    <?php } ?>
    <?php } else { ?>
        <?php if ($event_time == 'upcoming') { ?>
            <h3>You have no upcoming events in this section</h3>
        <?php } else {?>
            <h3>You have no past events in this section</h3>
        <?php } ?>
    <?php } ?>
    <div class="paging" style="background-color: #EEECF1;">
        <center>
            <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class' => 'disabled')); ?>
            |
            <?php echo $this->Paginator->numbers(); ?>
            |
            <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled')); ?>
        </center>
        <br/>
        <center>
            <?php 
            echo $this->Paginator->counter(array(
                'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
            )); 
            ?>
        </center>
    </div>    
</div>

